<?php

namespace App\Http\Controllers\api;

use App\Http\Controllers\Controller;
use App\Models\StoreGoods;
use App\Service\CommonService;

class GoodsController extends Controller
{
    /**
     * User: YKY
     * DateTime: 2022/11/14 16:48
     * @return array
     * 商品列表
     */
    public function goodsList()
    {
        try {
            $goodsData = StoreGoods::select('id','image', 'store_name', 'ot_price', 'stock', 'sales', 'sort', 'is_show', 'updated_at')->get();
            return CommonService::success(200, '', $goodsData);
        } catch (\Exception $e) {
            return CommonService::fail('5001', $e->getMessage(), '');
        }
    }
    public function goodsInfo(){
        $gid=request()->input('gid');
        try {
            $goods=StoreGoods::where('id',$gid)->first();
            return CommonService::success(200,'查询成功',$goods);
        }catch (\Exception $e){

        }
    }
}
